<html>
<head><meta charset="utf-8"><title>How essential is the compile-time check for empty arrays? · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html">How essential is the compile-time check for empty arrays?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="236721016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236721016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236721016">(Apr 29 2021 at 18:18)</a>:</h4>
<p>I've <a href="https://users.rust-lang.org/t/u16-slice-to-u8-iterator/59078/11?u=scottmcm">twice</a> <a href="https://github.com/bevyengine/bevy/pull/1966#discussion_r616169211">recently</a> seen people misusing <code>align_to</code> since it's the "easiest" way to turn slices into slices of different-sized elements.</p>
<p>I'd love to be able to suggest <a href="https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.as_chunks"><code>as_chunks</code></a> instead, but it's unstable.  I'd normally just send a stabilization PR and ask for an FCP, but the <a href="https://github.com/rust-lang/rust/issues/74985#issue-670131723">tracking issue</a> says that it's currently blocked on a compile-time check for N==0, since it can't elegantly meet its postcondition in that case.</p>
<p>It seems like that's a long way off from being fixable, though.  Any thoughts on how essential that is, vs just doing the runtime <code>panic</code> it does today?  I'd certainly <em>rather</em> it not compile, but it's not like it's a subtle problem that is likely to slip past notice without the compiler error, nor is it something that causes perf problems.  So I'm tempted to say I'd rather have it stable with the panic than wait for <code>where N &gt; 0</code> to be allowed...</p>



<a name="236722386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236722386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236722386">(Apr 29 2021 at 18:28)</a>:</h4>
<blockquote>
<p>It seems like that's a long way off from being fixable, though.</p>
</blockquote>
<p>I personally think that using a compile time check is worth it here and in general would prefer to not stabilize this with a runtime check if we're going to  later add methods with compile time checks</p>



<a name="236722430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236722430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236722430">(Apr 29 2021 at 18:28)</a>:</h4>
<p>now, while we're a long time off from const wf bounds</p>



<a name="236722459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236722459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236722459">(Apr 29 2021 at 18:29)</a>:</h4>
<p>we are exactly 0 days off from being able to implement this as a fairly innocent hack</p>



<a name="236723098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236723098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236723098">(Apr 29 2021 at 18:33)</a>:</h4>
<p>add an attribute <code>#[rustc_non_zero_const_param(integer)]</code> which</p>



<a name="236723131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236723131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236723131">(Apr 29 2021 at 18:33)</a>:</h4>
<ul>
<li>requires const arguments instantiating the parameter to be fully concrete</li>
</ul>



<a name="236723155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236723155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236723155">(Apr 29 2021 at 18:33)</a>:</h4>
<ul>
<li>and causes an error if the argument is equal to 0</li>
</ul>



<a name="236723433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236723433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236723433">(Apr 29 2021 at 18:35)</a>:</h4>
<p>this would prevent users from using <code>as_chunks</code> with a generic <code>N</code> until we've either decided that this doesn't has to be a compile time bound or const wf bounds are close enough to stable</p>



<a name="236723480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236723480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236723480">(Apr 29 2021 at 18:35)</a>:</h4>
<p>which imo is a good way to postpone this decision while still getting most of the benefits of having this method on stable</p>



<a name="236724241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236724241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236724241">(Apr 29 2021 at 18:40)</a>:</h4>
<p>if this is desirable i can either implement this in the <em>fairly near</em>(a few weeks) future or mentor immediately if someone is interested in working on this</p>



<a name="236728783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236728783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236728783">(Apr 29 2021 at 19:11)</a>:</h4>
<p>Another option is to make this a deny-by-default lint, which is less hacky but doesn't prevent generic parameters</p>



<a name="236728864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236728864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236728864">(Apr 29 2021 at 19:12)</a>:</h4>
<p>(And of course, means that make it a hard error isn't backwards compatible, which might be unsatisfactory)</p>



<a name="236732868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236732868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236732868">(Apr 29 2021 at 19:39)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F/near/236728864">said</a>:</p>
<blockquote>
<p>(And of course, means that make it a hard error isn't backwards compatible, which might be unsatisfactory)</p>
</blockquote>
<p>yeah, while i except us to not necessarily end up with erroring here in the end, i do want to keep that option</p>



<a name="236746179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236746179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236746179">(Apr 29 2021 at 21:07)</a>:</h4>
<p>I'd be willing to make an attempt at this.  It's been a while since I added an attribute, though, so some pointers to where I should put these things and how I should check it would be appreciated.</p>



<a name="236751861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236751861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236751861">(Apr 29 2021 at 21:39)</a>:</h4>
<p>you could look at my recent <code>rustc_skip_array_during_method_dispatch</code>: <a href="https://github.com/rust-lang/rust/pull/84147/commits/b79af2fcde91abeae805c2dbccfdbf7114bfd47b">https://github.com/rust-lang/rust/pull/84147/commits/b79af2fcde91abeae805c2dbccfdbf7114bfd47b</a></p>



<a name="236751895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236751895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236751895">(Apr 29 2021 at 21:39)</a>:</h4>
<p>most of that boiler-plate is for the stored metadata though, not the attribute itself</p>



<a name="236761012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236761012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236761012">(Apr 29 2021 at 23:07)</a>:</h4>
<p>You could also use the <code>static_assert!</code> hack that stdarch is using. The error message is pretty bad though.</p>



<a name="236761065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236761065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236761065">(Apr 29 2021 at 23:07)</a>:</h4>
<p><a href="https://github.com/rust-lang/stdarch/blob/6cec76beed3d1d27c1b88826a0e5d8142f836d66/crates/core_arch/src/macros.rs#L69">https://github.com/rust-lang/stdarch/blob/6cec76beed3d1d27c1b88826a0e5d8142f836d66/crates/core_arch/src/macros.rs#L69</a></p>



<a name="236814312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236814312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236814312">(Apr 30 2021 at 10:27)</a>:</h4>
<p>that one also doesn't apply for <code>cargo check</code> though <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> as the errors happen during mono item collection</p>



<a name="236814440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236814440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236814440">(Apr 30 2021 at 10:28)</a>:</h4>
<p>it might have been sensible to use the same hack for stdarch <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span> might not be possible though</p>



<a name="236814520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236814520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236814520">(Apr 30 2021 at 10:29)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125270">scottmcm</span> <a href="#narrow/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F/near/236746179">said</a>:</p>
<blockquote>
<p>I'd be willing to make an attempt at this.  It's been a while since I added an attribute, though, so some pointers to where I should put these things and how I should check it would be appreciated.</p>
</blockquote>
<p>so i except this to be very similar to <code>rustc_args_required_const</code>, except that the actual error reporting should probably happen somewhere else</p>



<a name="236815472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236815472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236815472">(Apr 30 2021 at 10:38)</a>:</h4>
<p>it probably makes sense to reuse <code>rustc_passes::intrinsicck</code>, though the name is incorrect here <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="236816364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236816364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236816364">(Apr 30 2021 at 10:46)</a>:</h4>
<p>I think we could change the  <code>ExprVisitor</code>+ <code>ItemVisitor</code> combination to be generic over the behavior of the <code>ExprVisitor</code> and add a new pass reusing that impl.</p>
<p>We probably want to start with only allowing that attribute on methods and functions. This means we only have to check <code>hir::ExprKind::Path</code> and <code>hir::ExprKind::MethodCall</code> afaik</p>



<a name="236832750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236832750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236832750">(Apr 30 2021 at 13:21)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F/near/236814440">said</a>:</p>
<blockquote>
<p>it might have been sensible to use the same hack for stdarch <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span> might not be possible though</p>
</blockquote>
<p>The stdarch changes still haven't been merged yet, so it's still possible to change.</p>



<a name="236846068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236846068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236846068">(Apr 30 2021 at 14:51)</a>:</h4>
<p>hmm <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> i guess the question is whether is stdarch fine with not allowing const params as arguments?</p>



<a name="236846102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/236846102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#236846102">(Apr 30 2021 at 14:51)</a>:</h4>
<p>also not too sure what's the best way to extend this attribute to accept more complex conditions than just =! 0</p>



<a name="248387761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/248387761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#248387761">(Aug 04 2021 at 18:20)</a>:</h4>
<p>so, i did implement the attribute for functions and methods: <a href="https://github.com/lcnr/rust/commit/f99922d91ee19022a636d3cf53559771ae14f1c0">https://github.com/lcnr/rust/commit/f99922d91ee19022a636d3cf53559771ae14f1c0</a></p>



<a name="248387965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/248387965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#248387965">(Aug 04 2021 at 18:22)</a>:</h4>
<p>i still have to figure out a way to extend this to types as well, to prevent users from writing <code>ArrayChunks&lt;0&gt;</code> or something. I could move all of this to wf and verify it while typechecking, but that seems kinda ugly <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="248387991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/248387991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#248387991">(Aug 04 2021 at 18:22)</a>:</h4>
<p>going to open a thread about that in <code>t-compiler</code></p>



<a name="248388485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/How%20essential%20is%20the%20compile-time%20check%20for%20empty%20arrays%3F/near/248388485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/How.20essential.20is.20the.20compile-time.20check.20for.20empty.20arrays.3F.html#248388485">(Aug 04 2021 at 18:26)</a>:</h4>
<p>cross ref <a href="#narrow/stream/131828-t-compiler/topic/checking.20generic.20arg.20!.3D.200/near/248388441">https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/checking.20generic.20arg.20!.3D.200/near/248388441</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>